package book_management.operation.ipml;

import book_management.book.BookList;
import book_management.operation.IOperation;
import book_management.book.Book;

public  class AddOperation implements IOperation {

    @Override
    public void work(BookList bookList) {
        System.out.println("书名叫啥？");
        String booksName = scanner.next();
        // 判断一下当前书籍是否已经存在
        if (bookList.contains(booksName)) {
            System.out.println("书本已经存在，无需重复添加~");
            return;
        }else {
            System.out.println("作者叫啥？");
            String author = scanner.next();
            System.out.println("啥类型书？");
            String type = scanner.next();
            System.out.println("多少钱？");
            double price = scanner.nextDouble();
            Book book = new Book(booksName , author , type , price);
            bookList.add(book);
            System.out.println("好了，加进去了");
        }
    }
}

